from selenium import webdriver
import selenium
from selenium.webdriver.chrome.options import Options

#获取到酒店的id,返回0就是传入的参数有错误
def getroomid(bris,city,HotelName):
    url1="https://i.meituan.com/s/%s-%s?cid=20&cateType=poi"%(city,HotelName)
    print(url1)
    bris.get(url1)
    try:
        HotelId=bris.find_element_by_xpath('//*[@id="deals"]/dl/dd[1]/dl[1]/dd/a').get_attribute("href")
        return HotelId.split("/")[4]
    except:
        return 0
   